<!DOCTYPE html>
<html>
<head>
<include file="CommonHome:head.meta.inc" />
<include file="CommonHome:head.script.inc" />
</head>
<body>
	
	
	<style type="text/css">

.current { display:none}
.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; }
	</style>

<div data-role="page" id="pageone">
<script> 
    
    
    /* jquery tab functions */
var jqshow_current;
var jqshow_callback;
var TABMAX = 5;
function defTableCallback(curr) {
    for(var i=1;i<=TABMAX;i++){
        ajaxt ="ajaxin" +i;
        var jqobj = $("#"+ajaxt);
        if (jqobj.length <=0) {break;}
        if(i==curr) {
            jqobj.show();
        }else{
            jqobj.hide();
        }
    }
}
function jqshowInitTable(idx){
    jqshowInit(idx,defTableCallback);
}
function jqshowInit(idx,callback){
    jqshow_current = idx;
    jqshow_callback = callback;
}
function jqshowSetCurrent(curr){
    jqshow_current = curr;
}
function jqshowGetCurrent(){
    return jqshow_current;
}
function jqshowCurrent(){
    jqshow(jqshow_current);
}
function jqshow(curr){
    for(var i=1;i<=TABMAX;i++){
        thead ="thread_type_all"+i;
        var jqobj = $("#"+thead);
        if (jqobj.length <=0) {break;}
        if(i==curr) {
           // jqobj.addClass("current");
           // jqobj.removeClass("current");
            //jqobj.style.display='';
            jqobj.show();
        }else{
            //jqobj.removeClass("current");
             //jqobj.addClass("current");
             //jqobj.style.display='none';
              jqobj.hide();
        }
    }
    jqshow_current = curr;
    if (jqshow_callback)
        jqshow_callback(curr);
}
/* end jquery tab functions */


    
    
    //var title={"title":["No.","代码","日期","最高","最低","open","close","成交量","成交额","涨幅","振幅","换手","mv","AVG"]};
    var title={"title":["已选菜谱"]};
    
    var strtest = 
        [
            [{"Group_Id":"0","Group_Name":"已选菜谱","PicId":"0"}]
            ,[{"Group_Id":"2","Group_Name":"备注","PicId":"0"}]
        ];
        
        var dishesListold = { "dish":[0,"已选菜谱",0]}
        
        var dishesList = new   Array([0,'已选菜',0]); 
         

        for(var i in strtest){
            //document.write(strtest[i][0].Group_Id+"-"+strtest[i][0].Group_Name+"-"+strtest[i][0].PicId+"<br/>");
            $("#clac").append(strtest[i][0].Group_Id+"-"+strtest[i][0].Group_Name+"-"+strtest[i][0].PicId+"<br/>");  
        }
    
$(document).on("pagebeforeshow","#pageone",function(){
  //alert("pagebeforeshow event fired - pagetwo is about to be shown");
  // $("#myPanel").css("ui-panel-dismiss-open","display: block");
  
  for(var i in strtest){
            //document.write(strtest[i][0].Group_Id+"-"+strtest[i][0].Group_Name+"-"+strtest[i][0].PicId+"<br/>");
        //  $("#clac").append(strtest[i][0].Group_Id+"-"+strtest[i][0].Group_Name+"-"+strtest[i][0].PicId+"<br/>");  
        }
   
});


function combine(id,fname,price){
    //alert(dishesList[0]);
    var vflag= true;
   // for(var i in dishesList){
    for(i=0;i<dishesList.length;i++) {  
        
           var opf = dishesList[i][0];
           var opn = dishesList[i][1];
            if(opf==id){
               // alert(arr[i].c);
              
                dishesList.splice(i,1);
                vflag =false;
               // return;
            }
        }
        
        if(vflag){
            //dishesList.push( Array([id,fname,price]));
            
            dishesList.push([id,fname,price]);
            //alert (dishesList.length);
        }
        
        
        
           
           
        $("#clac").empty();
        var str = "";
        var pricetotal = 0;
        for(i=0;i<dishesList.length;i++) {  
             var idx = dishesList[i][0];
             var namex = dishesList[i][1];
             var pricex = dishesList[i][2];
             str= str + "<p>"+ namex +"</p>";
             pricetotal=pricetotal+ pricex;
             
        }
        str +="<p> -------       </p>"; 
        str = str +"<p>合计"+ pricetotal +"元</p>";
        
        $("#clac").append(str);
}

</script> 
	 
	
	
  <div data-role="header">
  	
  <h1>点餐 Demo</h1>
 
  </div>
  

  
  
  <div data-role="main" class="ui-content">
      <form method="post" action="__URL__/order">
  <p>时间 {:now()}</p>  
  <p>台号 {$vo.table_num}</p> 

<div class="ui-grid-b">
	
	<div class="ui-block-b"><div class="ui-bar ui-bar-a" id="clac">
    	
     <h2>已选菜谱</h2>
  
   <p> 粉蒸芹菜叶       </p>
   <p> 放心油条        </p>
   <p> 松饼          </p>
   <p> 炝拌韭菜        </p>
   <p> -------       </p>
   <p> 合计 3450元      </p>
   
	</div></div>
	
    <div class="ui-block-b"><div class="ui-bar ui-bar-a">
    <volist name="list" id="vo">
    <p id="leibie{$vo.id}"  onclick="jqshow({$vo.id});"> {$vo.sortname}</p>
    </volist>
    	
    </div></div>
    
    <volist name="list" id="vo">
    <div class="ui-block-b"><div class="ui-bar ui-bar-a" style="background: #f6f600;display:none" id="thread_type_all{$vo.id}">   
        <volist name="vo['goods']" id="sub">
        <p onclick="combine({$sub.id},'{$sub.goodsname}',{$sub.marketprice})"> {$vo.sortname} {$sub.goodsname} </p>   
        </volist>   
    </div></div>
    </volist>

   
   
   
  <div class="ui-block-b"><div class="ui-bar ui-bar-a" style="background: #f6f600;display:none" id="thread_type_all2">  	
   <p> 海鲜私家菜白菜	  </p>                 
   <p> 海鲜面包       </p>
   <p> 海鲜炖小脆骨排    </p>
   <p> 海鲜发糕       </p>
   <p> 海鲜鸡腿       </p>
   <p> 海鲜蛋        </p>
   <p> 海鲜司康       </p>
   <p> 海鲜腐        </p>
   </div></div>
 
   
   

   
   
</div><!-- /grid-b -->
      
      <input type="text" name="food_list" value="" id="food_list" />
      <a href="#myPanel" class="ui-btn ui-btn-inline ui-corner-all ui-shadow">确认</a>
      <input type="hidden" name="id" value="{$vo.id}" />
      <input type="submit" data-inline="true" value="提交">
      
      <a href="__URL__/begin/id/{$vo.id}" class="ui-btn ui-btn-inline">返回</a>
       
    </form>
               
                

   </div>
 


          
  <div data-role="footer" data-position="fixed">
  <h1>Copyright </h1>
  </div>
</div> 




</body>
</html>

                                                                                                                                                                  